﻿@section header{

}
<partial name="_page_list" />
@section scripts{
    <script>
        var baseUrl = "/Personnel/Roster/";
        $(function () {
            bindPersonAC($("#txt_keyword"));
            //选择后的操作
            $($("#txt_keyword")).result(function (event, data, formatted) {
                $("#txt_keyword").val(data != null ? data.Account : "");
            });
            gridList();
        })
        function gridList() {
            var $gridList = $("#gridList");
            $gridList.dataGrid({
                url: "/rbac/User/GetJGridPageDataJson",
                datatype: "json",
                height: $(window).height() - 120,
                mtype: "POST",
                colModel: [
                    { label: "主键", name: "ID", hidden: true, key: true },
                    {
                        label: '排序', name: 'OrderBy', width: 100, align: 'center', frozen: true,
                        formatter: function (cellvalue, options, rowObject) {
                            var keyId = rowObject.ID;
                            return "<input type='text' name='OrderBy[" + keyId + "]' autocomplete='off' style='width: 50px; height: 20px;' onchange='update_field(\"" + keyId + "\",this.value)' value=" + cellvalue + " />";
                        }
                    },
                    { label: '登录帐号', name: 'Account', width: 100, align: 'left', frozen: true },
                    { label: '用户姓名', name: 'Name', width: 100, align: 'left', frozen: true },
                    { label: '用户性别', name: 'Sex', width: 50, align: 'left' },
                    {
                        label: "用户状态", name: "Status", align: "center", width: 100,
                        formatter: function (cellvalue, options, rowObject) {
                            var keyId = rowObject.ID;
                            return cellvalue == 0 ? "<i onclick='Switch(\"" + keyId + "\")' class=\"fa fa-toggle-on\"></i>" : "<i onclick='Switch(\"" + keyId + "\")' class=\"fa fa-toggle-off\"></i>";
                        }
                    },
                    { label: '用户手机', name: 'Mobile', width: 100, align: 'left' },
                    { label: '电子邮箱', name: 'Email', width: 120, align: 'left' },
                    { label: '证件类型', name: 'IdcardType', width: 80, align: 'left' },
                    { label: '证件号码', name: 'Idcard', width: 120, align: 'left' },
                    { label: '国籍地区', name: 'Nationality', width: 100, align: 'center' },
                    {
                        label: '宗教信仰', name: 'Faith', align: 'left', width: 100,
                        formatter: function (cellvalue) {
                            try {
                                return top.clients.dataItems["ZJXY"][cellvalue] == undefined ? "" :
                                    top.clients.dataItems["ZJXY"][cellvalue]
                            } catch (err) {
                                return "";
                            }
                        }
                    },
                    {
                        label: '健康状况', name: 'Health', align: 'left', width: 100,
                        formatter: function (cellvalue) {
                            try {
                                return top.clients.dataItems["JKZK"][cellvalue] == undefined ? "" :
                                    top.clients.dataItems["JKZK"][cellvalue]
                            } catch (err) {
                                return "";
                            }

                        }
                    },
                    {
                        label: '婚姻状态', name: 'Marry', align: 'left', width: 100,
                        formatter: function (cellvalue) {
                            try {
                                return top.clients.dataItems["HYZT"][cellvalue] == undefined ? "" :
                                    top.clients.dataItems["HYZT"][cellvalue]
                            } catch (err) {
                                return "";
                            }
                        }
                    },
                    {
                        label: '政治面貌', name: 'PoliticalID', align: 'left', width: 100,
                        formatter: function (cellvalue) {
                            try {
                                return top.clients.dataItems["ZZMM"][cellvalue] == undefined ? "" :
                                    top.clients.dataItems["ZZMM"][cellvalue]
                            } catch (err) {
                                return "";
                            }
                        }
                    },
                    { label: '生肖', name: 'Zodiac', width: 100, align: 'left' },
                    { label: '星座', name: 'Constellation', width: 100, align: 'left' },
                    {
                        label: '出生日期', name: 'BirthDate', width: 120, align: 'left',
                        formatter: "date", formatoptions: { srcformat: 'Y-m-d', newformat: 'Y-m-d' }
                    },
                    { label: '名族', name: 'NationalID', width: 100, align: 'left' },
                    { label: '籍贯', name: 'NativePlace', width: 100, align: 'left' },
                    { label: '邮寄地址', name: 'Address', width: 100, align: 'left' },
                    { label: '邮编', name: 'Zipcode', width: 100, align: 'left' },
                    { label: '添加时间', name: 'AddTime', width: 120, align: 'center' }
                ],
                rowNum: 20,
                rowList: [20, 50, 100],
                pager: '#gridPager',
                sortname: 'ID',
                sortorder: "asc",
                viewrecords: true,
                autowidth: true,
                multiselect: true
            });
            $("#btn_search").click(function () {
                $gridList.jqGrid('setGridParam', {
                    postData: { keyword: $("#txt_keyword").val() },
                }).trigger('reloadGrid');
            });
        }
       
    </script>
}